package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.IngreFeedRemark;
import com.ruoyi.system.service.IIngreFeedRemarkService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 原料备料危害性及防护提示类型Controller
 * 
 * @author ruoyi
 * @date 2025-02-13
 */
@RestController
@RequestMapping("/system/remark")
@Api(tags = "原料备料危害性及防护提示类型管理")
public class IngreFeedRemarkController extends BaseController
{
    @Autowired
    private IIngreFeedRemarkService ingreFeedRemarkService;

    /**
     * 查询原料备料危害性及防护提示类型列表
     */
    @PreAuthorize("@ss.hasPermi('system:remark:list')")
    @GetMapping("/list")
    @ApiOperation("查询原料备料危害性及防护提示类型列表")
    public TableDataInfo list(@RequestBody IngreFeedRemark ingreFeedRemark, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize)
    {

        List<IngreFeedRemark> list = ingreFeedRemarkService.selectIngreFeedRemarkList(ingreFeedRemark, pageNum, pageSize);
        Long total = ingreFeedRemarkService.selectIngreFeedRemarkCount(ingreFeedRemark);
        return getDataTable(list, total);
    }

    /**
     * 导出原料备料危害性及防护提示类型列表
     */
    @PreAuthorize("@ss.hasPermi('system:remark:export')")
    @Log(title = "原料备料危害性及防护提示类型", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出原料备料危害性及防护提示类型列表")
    public void export(HttpServletResponse response, IngreFeedRemark ingreFeedRemark)
    {
        List<IngreFeedRemark> list = ingreFeedRemarkService.selectIngreFeedRemarkAll(ingreFeedRemark);
        ExcelUtil<IngreFeedRemark> util = new ExcelUtil<IngreFeedRemark>(IngreFeedRemark.class);
        util.exportExcel(response, list, "原料备料危害性及防护提示类型数据");
    }

    /**
     * 获取原料备料危害性及防护提示类型详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:remark:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取原料备料危害性及防护提示类型详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ingreFeedRemarkService.selectIngreFeedRemarkById(id));
    }

    /**
     * 新增原料备料危害性及防护提示类型
     */
    @PreAuthorize("@ss.hasPermi('system:remark:add')")
    @Log(title = "原料备料危害性及防护提示类型", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增原料备料危害性及防护提示类型")
    public AjaxResult add(@RequestBody IngreFeedRemark ingreFeedRemark)
    {
        return toAjax(ingreFeedRemarkService.insertIngreFeedRemark(ingreFeedRemark));
    }

    /**
     * 修改原料备料危害性及防护提示类型
     */
    @PreAuthorize("@ss.hasPermi('system:remark:edit')")
    @Log(title = "原料备料危害性及防护提示类型", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    @ApiOperation("修改原料备料危害性及防护提示类型")
    public AjaxResult edit(@RequestBody IngreFeedRemark ingreFeedRemark)
    {
        return toAjax(ingreFeedRemarkService.updateIngreFeedRemark(ingreFeedRemark));
    }

    /**
     * 删除原料备料危害性及防护提示类型
     */
    @PreAuthorize("@ss.hasPermi('system:remark:remove')")
    @Log(title = "原料备料危害性及防护提示类型", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation("删除原料备料危害性及防护提示类型")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ingreFeedRemarkService.deleteIngreFeedRemarkByIds(ids));
    }
}
